#include <QtGui/QApplication>
#include "widget/widget.h"
#include <QTextCodec>
#include "widget/newuserwidget.h"
#include "toolkit/toolkit.h"
#include "widget/mainview.h"
#include<boost/asio.hpp>
#include "database/mydatabase.h"
#include "net/Log.h"
#include "widget/widgetmanager.h"

boost::asio::io_service iorun;
NewUserWidget   *newWidget = NULL;
MainView        *mainview = NULL;
WidgetManager   *widgetMag = NULL;

void initWidget()
{
    newWidget = new NewUserWidget();
    newWidget->setGeometry(400,200,400,200);
    newWidget->setVisible(false);
    ToolKit::m_newUserWidget = newWidget;

    mainview = new MainView();
    mainview->setGeometry(400,100,200,600);
    mainview->setVisible(false);
    ToolKit::m_mainview = mainview;
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTextCodec::setCodecForTr(QTextCodec::codecForLocale());

    yssdk::g_log.openLog ("log.log");

    initWidget();

    widgetMag = new WidgetManager;

    Widget w;
    ToolKit::m_loginWidget = &w;
    w.setGeometry(400,200,400,50);
    w.show();

    g_db.initDB();

    return a.exec();
}
